let arr = [9, 'a', 7, 'b', 5, 'luck', 5, 'haha'];
console.log(arr.indexOf(5));  // 4
console.log(arr.indexOf('kobe')); // -1
console.log(arr.lastIndexOf(5));  // 6
console.log(arr.lastIndexOf('kobe')); // -1

arr = [9, 'a', 7, 'b', 5, 'luck', 5, 'haha'];
console.log(arr.includes(7)); // true
console.log(arr.includes(6666)); // false
console.log(arr.at(-1)); // haha
console.log(arr.at(5)); // luck
console.log(arr.at(10)); // undefined


arr = [9, 'a', 7, 'b', 5, 'luck', 5, 'haha'];
console.log(arr.find(value => {
  return value > 6;
})); // 9
console.log(arr.findIndex(value => {
  return value > 6;
})); // 0

const objArr = [
  { name: 'zg', age: 18 },
  { name: 'kobe', age: 44 },
  { name: 'lucy', age: 20 }
];
console.log(objArr.find(item => {
  return item.age > 20;
}));
/**结果
{
  "name": "kobe",
  "age": 44
}
*/

console.log(objArr.find(item => {
  return item.name == 'hello';
}));
// undefined

console.log(objArr.findIndex(item => {
  return item.name == 'kobe';
})); 
// 1

console.log(objArr.findIndex(item => {
  return item.age < 0;
})); 
// -1
